package com.life.wd.controller;

import com.life.wd.result.Result;
import com.life.wd.service.DashboardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/api/dash")
@Slf4j
@Api(tags = "仪表盘")
public class DashboardController {
    @Autowired
    private DashboardService dashboardService;

    @GetMapping
    public Result getDashTotal() {
        log.info("查询仪表盘数据");
        HashMap<String, Integer> res = new HashMap<>();
        int video = dashboardService.getVideoTotalService();
        int user = dashboardService.getUserTotalService();
        int order = dashboardService.getOrderTotalService();
        int report = dashboardService.getReportTotalService();
        res.put("video",video);
        res.put("user",user);
        res.put("order",order);
        res.put("report",report);
        return Result.success(res);
    }
}
